package com.foryou.wechat.service.impl;

import com.foryou.wechat.common.Constants;
import com.foryou.wechat.entity.SysOpinionEntity;
import com.foryou.wechat.mapper.SysOpinionMapper;
import com.foryou.wechat.service.SysOpinionService;
import com.foryou.wechat.utils.Response;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Lee.
 */
@Service
public class SysOpinionServiceImpl implements SysOpinionService {

    @Autowired
    private SysOpinionMapper sysOpinionMapper;

    @Override
    public Response addOpinion(String opinion, Long userId) {
        if (StringUtils.isBlank(opinion)) {
            return Response.failure("请填写您的意见！");
        }
        sysOpinionMapper.insert(new SysOpinionEntity(opinion, userId));
        return Response.success();
    }
}
